<template>
  <div id="app">
    <router-view />
  </div>
</template>

<script>
export default {
  created() {
    if (location.hash.split("#/")[1] == "login") return;
    const token = localStorage.getItem("token");
    if (token != "null") this.$store.commit("login", token);
    if (!this.$store.state.token) {
      this.$message.error("请登录");
      setTimeout(() => {
        this.$router.push({
          name: "login",
        });
      }, 500);
    }
  },
};
</script>

<style lang="scss">
* {
  margin: 0;
  padding: 0;
  border: none;
}
#app {
  font-family: Avenir, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  color: #2c3e50;
}
// .flex{
//   display: flex;
// }
.headicon {
  width: 40px;
  height: 40px;
}
.el-pagination {
  margin-top: 10px;
}
</style>
